﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Diagnostics;

namespace ExportToDWGTool
{
    public partial class DataBaseConn : Form
    {
        public string m_strIP = "";
        public string m_strDB = "";
        public string m_strUID = "";
        public string m_strPWD = "";
        public DataBaseConn()
        {
            InitializeComponent();

            this.textBox1.Text = "10.10.100.161";
            this.textBox2.Text = "DL_DYSJHCDataBase";
            this.textBox3.Text = "sa";
            this.textBox4.Text = "123456";
        }

        private void DataBaseConn_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            m_strIP = textBox1.Text;
            m_strDB = textBox2.Text;
            m_strUID = textBox3.Text;
            m_strPWD = textBox4.Text;
            try
            {
                ReadDataFromSQL db = new ReadDataFromSQL(m_strIP, m_strDB, m_strUID, m_strPWD);
                db.sqlConnection.Open();

                MessageBox.Show("数据库连接成功！", "提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
               // this.Close();
            }
          
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }


    }
}
